package LECONGHAU.OOP.LUYENTAP.BAI2;

public class MODELS {
	double thanhtien;

	public double TinhTien(double hbatdau, double hketthuc) {
		double hbatdau1 = (int) hbatdau * 60 + (hbatdau - (int) hbatdau) * 100;
		double hketthuc1 = (int) hketthuc * 60 + (hketthuc - (int) hketthuc)
				* 100;
		double hchoi = (hketthuc1 - hbatdau1);
		if (hbatdau >= 7 && hketthuc <= 17) {
			if (hchoi > 6 * 60) {
				thanhtien = 200 * hchoi - 200 * hchoi * 10 / 100;
			} else {
				thanhtien = 200 * hchoi;
			}

		} else if (hbatdau > 17 && hketthuc <= 24) {
			if (hchoi > 4 * 60) {
				thanhtien = 150 * hchoi - 150 * hchoi * 12 / 100;
			} else {
				thanhtien = 150 * hchoi;
			}

		} else if (hbatdau > 0 && hketthuc < 7) {
			if (hchoi > 5 * 60) {
				thanhtien = 100 * hchoi - 100 * hchoi * 15 / 100;
			} else {
				thanhtien = 100 * hchoi;
			}
		}
		return thanhtien;
	}
}
